/*
 * @Author: your name
 * @Date: 2021-09-01 11:25:49
 * @LastEditTime: 2021-09-01 14:37:03
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \bigdate\src\setting\locales\useI18n.ts
 */
import i18n from './setlocales'
import { GetLocalStrong, SetLocalStrong } from '../../ntils/hooks'

const { t } = i18n.global

// 路由国际化
export const key = (key: string) => t(key)

// 设置国际化
export const updateLang = (langs:string) => {
    let APP_LANG_LOCAL = GetLocalStrong('APP_LANG_LOCAL')
    if (APP_LANG_LOCAL == langs) return
    SetLocalStrong({ key: 'APP_LANG_LOCAL', value: langs })
    i18n.global.locale = langs 
}